<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <body>

        <ui:composition template="template.xhtml">
            <ui:define name="mainMenu">
                <ui:include src="mainMenu.xhtml"/>
            </ui:define>
            <ui:define name="navigation">
                <ui:include src="menu.xhtml">
                    <ui:param name="select" value="#{2}"/>
                </ui:include>
            </ui:define>

            <ui:define name="content">
                <h1>
                    #{bundle.TitleAdd}
                </h1>
                <h:form>
                    <h:panelGrid styleClass="panelGrid" columns="2" columnClasses="rightAlign, leftAlign">
                        <h:outputText value="#{bundle.TitleOrg}"/>
                        <h:inputText id="titleOrg"
                                     label="#{bundle.TitleOrg}"
                                     value="#{addBean.titleOrg}"
                                     maxlength="35" >
                            <f:validateRequired />
                        </h:inputText>

                        <h:outputText value="#{bundle.TitleEn}"/>
                        <h:inputText id="titleEn"
                                     label="#{bundle.TitleEn}"
                                     value="#{addBean.titleEn}"
                                     maxlength="35"/>

                        <h:outputText value="#{bundle.TitlePl}"/>
                        <h:inputText id="titlePl"
                                     label="#{bundle.TitlePl}"
                                     value="#{addBean.titlePl}"
                                     maxlength="35"/>

                        <h:outputText value="#{bundle.Year}"/>
                        <h:inputText id="year" maxlength="4" required="true"
                                     label="#{bundle.Year}"
                                     value="#{addBean.year}"/>

                        <h:outputText id="lala" value="#{bundle.Genre}"/>
                        <h:selectManyListbox rendered="#{languageSwitcher.language == 'pl'}" label="#{bundle.Genre}" value="#{addBean.genre}" size="10">                            
                                <c:forEach items="#{addBean.genresdb}" var="g">
                                    <f:selectItem itemValue="#{g.namePl}" itemLabel="#{g.namePl}"/>
                                </c:forEach>
                              <f:validateRequired />
                        </h:selectManyListbox>
                        <h:selectManyListbox rendered="#{languageSwitcher.language == 'en'}" label="#{bundle.Genre}" value="#{addBean.genre}" size="10">
                                <c:forEach items="#{addBean.genresdb}" var="g">
                                    <f:selectItem itemValue="#{g.nameEn}" itemLabel="#{g.nameEn}"/>
                                </c:forEach>
                            <f:validateRequired />
                        </h:selectManyListbox>
                            


                        <h:outputText value="#{bundle.Quality}"/>
                        <h:selectOneListbox value="#{addBean.quality}" size="1" >
                            <ui:repeat value="#{addBean.qualitiesFromDB}" var="q">
                                <f:selectItem itemValue="#{q.name}" itemLabel="dupa"/>
                            </ui:repeat>
                            <c:forEach items="#{addBean.qualitiesFromDB}" var="q">
                                <f:selectItem itemValue="#{q.name}" itemLabel="#{q.name}"/>
                            </c:forEach>

                        </h:selectOneListbox>


                        <h:outputText value="#{bundle.Size}"/>
                        <h:inputText id="size" maxlength="6" required="true"
                                     label="#{bundle.Size}"
                                     value="#{addBean.fileSize}">

                        </h:inputText>
                        
                        <h:panelGroup> </h:panelGroup>
                        <h:commandButton value="#{bundle.Submit}" action="#{addBean.add}"/>
                    </h:panelGrid>
                    <h:messages styleClass="errorMsg" > </h:messages>

                </h:form>
            </ui:define>


        </ui:composition>

    </body>
</html>
